//-------------------------------------------------------------------
//	Copyright (c) 2010-2014  Zhirnov Andrey
//	This file is part of the "UX Standard Lib" project.
//	See copyright notice in "UX_STL_Ext.h".
//-------------------------------------------------------------------

#ifndef _UXS_SDL_TIMER_H
#define _UXS_SDL_TIMER_H

#pragma once

#include "OS_SDL.h"

#ifdef PLATFORM_SDL

#include "../Base/Date.h"

namespace UX_STL
{
namespace _platform_
{
	
	//
	// Perfomance Timer
	//

	struct PerfTimer
	{
	private:
		uint64	_freq;

	public:
		PerfTimer ()
		{
			_freq = ::SDL_GetPerformanceFrequency();
		}

		// seconds
		double GetTime () const
		{
			return double(::SDL_GetPerformanceCounter()) / _freq;
		}

		// milliseconds
		uint64 GetTimeMilliSec () const
		{
			return uint64( GetTime() * 1.0e3 + 0.5 );
		}

		// microseconds
		uint64 GetTimeMicroSec () const
		{
			return uint64( GetTime() * 1.0e6 + 0.5 );
		}
		/*
		// milliseconds
		uint32 GetTicks () const
		{
			return ::SDL_GetTicks();
		}*/
	};

	
//-------------------------------------------------------------------

}	// _platform_
}	// UX_STL

#endif	// PLATFORM_SDL
#endif	// _UXS_SDL_TIMER_H